import httpInstance from "@/utils/http"

export function getSpace(){
    return httpInstance({
        method:"get",
        url:"/user/space"
    })
}

export function filePage(pid,page,category){
    return httpInstance({
        method:"get",
        url:`/user/file/list?pid=${pid}&page=${page}&category=${category}`
    })
}

export function deleteFileById(fileIds){
    return httpInstance({
        method:"delete",
        url:`/user/delete/${fileIds}`
    })
}

export function restoreFileById(fileIds){
    return httpInstance({
        method:"put",
        url:`/user/restore/${fileIds}`
    })
}

export function deleteFileInfoById(fileIds){
    return httpInstance({
        method:"delete",
        url:`/user/remove/${fileIds}`
    })
}

export function renameByIdAndName(id,name) {
    return httpInstance({
        method: "put",
        url: `/user/rename/${id}/${name}`
    })
}

export function getUserId() {
    return httpInstance({
        method: "get",
        url: `/user/id`
    })
}

export function getUploadRecords() {
    return httpInstance({
        method: "get",
        url: `/user/uploadInfo`
    })
}

export function newFolder(pid,folderName) {
    return httpInstance({
        method: "post",
        url: `/user/newFolder/${pid}/${folderName}`
    })
}

export function searchFile(search) {
    return httpInstance({
        method: "get",
        url: `/user/search/${search}`
    })
}

export function moveByIds(ids,pid) {
    return httpInstance({
        method: "put",
        url: `/user/move/${ids}/${pid}`
    })
}

export function folderByPid(pid) {
    return httpInstance({
        method: "get",
        url: `/user/folder/${pid}`
    })
}

export function uploadInfo() {
    return httpInstance({
        method: "get",
        url: `/user/uploadInfo`
    })
}

export function deleteShardByMd5(md5) {
    return httpInstance({
        method: "delete",
        url: `/user/deleteShardByMd5/${md5}`
    })
}

export function deleteShardAll() {
    return httpInstance({
        method: "delete",
        url: `/user/deleteShardAll`
    })
}

export function shardNum() {
    return httpInstance({
        method: "get",
        url: `/user/shardNum`
    })
}

export function avatarUpload(fileData) {
    return httpInstance({
        method: "post",
        url: `/user/avatar`,
        headers: {
            'Content-Type': 'multipart/form-data',
        },
        data:fileData
    })
}

export function getUpdateCode() {
    return httpInstance({
        method: "get",
        url: `/user/updateCode`
    })
}

export function getUploadInfo() {
    return httpInstance({
        method: "get",
        url: `/user/updateInfo`
    })
}

export function uploadUser(user) {
    return httpInstance({
        method: "put",
        url: `/user/update`,
        data: user
    })
}

export function saveShare(ids) {
    return httpInstance({
        method: "post",
        url: `/user/saveCloudDisk/${ids}`,
    })
}

export function getAvatarStr() {
    return httpInstance({
        method: "get",
        url: `/user/getAvatarStr`,
    })
}